﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SGRapidForm.Permission.Service.Interface;
using SGRapidForm.Permission.Entity;
using SGRapidForm.Permission.Component;
using System.Collections.Specialized;
using SGRapidForm.Common;
using System.Data;
using Microsoft.Practices.Unity;

namespace SGRapidForm.Permission.Service
{
    public partial class PermissionService : IPermissionService
    {
        [Dependency]
        public DeptComponent DeptComponent
        { get; set; }

        /// <summary>
        /// 新增一个部门
        /// </summary>
        /// <param name="dept">部门明细</param>
        /// <returns></returns>
        public bool Dept_Add(Dept dept)
        {
            return this.DeptComponent.Dept_Add(dept);
        }

        /// <summary>
        /// 删除一个指定部门
        /// </summary>
        /// <param name="keyid">部门Keyid</param>
        /// <returns></returns>
        public bool Dept_Delete(string keyid)
        {
            return this.DeptComponent.Dept_Delete(keyid);
        }

        /// <summary>
        /// 批量删除部门
        /// </summary>
        /// <param name="keyids">部门Keyid集合</param>
        /// <returns></returns>
        public bool Dept_BulkDelete(string keyids)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 更新一个指定部门
        /// </summary>
        /// <param name="dept">部门部门明细</param>
        /// <returns></returns>
        public bool Dept_Update(Dept dept)
        {
            return this.DeptComponent.Dept_Update(dept);
        }

        /// <summary>
        /// 过滤查询部门
        /// </summary>
        /// <param name="filterConditions">Sql查询过滤条件</param>
        /// <returns></returns>
        public List<Dept> Dept_FilteredGetAll(string filterConditions)
        {
            return this.DeptComponent.Dept_FilteredGetAll(filterConditions);
        }

        /// <summary>
        /// 根据Keyid查询一部门
        /// </summary>
        /// <param name="keyid"></param>
        /// <returns></returns>
        public Dept Dept_GetByKeyid(string keyid)
        {
            return this.DeptComponent.Dept_GetByKeyid(keyid);
        }

        /// <summary>
        /// 查询指定用户被分配的部门
        /// </summary>
        public List<Dept> Dept_GetByUserKeyid(string userKeyid)
        {
            return this.DeptComponent.Dept_GetByUserKeyid(userKeyid);
        }

        /// <summary>
        /// 查询指定用户未被分配的部门
        /// </summary>
        public List<Dept> Dept_GetUnmappedByUserKeyid(string userKeyid)
        {
            return this.DeptComponent.Dept_GetUnmappedByUserKeyid(userKeyid);
        }

        public List<Dept> Dept_GetDeptAll()
        {
            return this.DeptComponent.Dept_GetDeptAll();
        }

        //通知通告部门选择
        public List<Dept> Notice_FilteredGetAll(String filterConditions)
        {

            return this.DeptComponent.Notice_FilteredGetAll(filterConditions);
        }
    }
}
